﻿<labs:SilverlightLab x:Class="DaveSexton.Labs.SilverlightConsoleLab" 
										 xmlns:labs="clr-namespace:DaveSexton.Labs;assembly=DaveSexton.Labs"
										 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
										 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
										 xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
										 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
										 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
										 mc:Ignorable="d"
										 d:DesignWidth="640" d:DesignHeight="480"
										 DataContext="{Binding RelativeSource={RelativeSource Self}}">
	<labs:SilverlightLab.Resources>

		<Style TargetType="Button">
			<Setter Property="Width" Value="150" />
			<Setter Property="Height" Value="70" />
			<Setter Property="FontSize" Value="15" />
		</Style>

		<labs:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
		<labs:InverseBooleanConverter x:Key="InverseBooleanConverter" />

	</labs:SilverlightLab.Resources>

	<Grid Background="#F1FFFA">
		<Border BorderBrush="LightSteelBlue" BorderThickness="2" Padding="2"
						HorizontalAlignment="Center" VerticalAlignment="Center"
						MaxWidth="500">
			<Border BorderBrush="White" BorderThickness="5" Padding="10 20 10 0"
							HorizontalAlignment="Center" VerticalAlignment="Center">
				<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">

					<TextBlock HorizontalAlignment="Center" FontSize="20" FontWeight="Bold" Text="{Binding DisplayName}" />

					<TextBlock HorizontalAlignment="Center" FontSize="18" Text="{Binding FullCategory}" />

					<ComboBox ItemsSource="{Binding Experiments}"
										SelectedItem="{Binding SelectedExperiment, Mode=TwoWay}"
										IsEnabled="{Binding IsRunning, Converter={StaticResource InverseBooleanConverter}}"
										Visibility="{Binding HasExperiments, Converter={StaticResource BooleanToVisibilityConverter}}"
										Margin="0 5 0 0">
						<ComboBox.ItemTemplate>
							<DataTemplate>
								<TextBlock Text="{Binding DisplayName}" />
							</DataTemplate>
						</ComboBox.ItemTemplate>
					</ComboBox>

					<TextBlock HorizontalAlignment="Center" FontSize="15" Text="{Binding Description}"
										 Margin="10" TextWrapping="Wrap" />

					<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">

						<Button Grid.Column="0" Margin="20 20"
										Name="StartButton"
										IsEnabled="{Binding IsRunning, Converter={StaticResource InverseBooleanConverter}}"
										Content="{Binding StartButtonText}" />

					</StackPanel>

				</StackPanel>
			</Border>
		</Border>

		<toolkit:DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="4"
											 Visibility="{Binding WaitingForUserInput, Converter={StaticResource BooleanToVisibilityConverter}}">

			<TextBlock toolkit:DockPanel.Dock="Left" VerticalAlignment="Center" 
								 FontSize="14" Text="Input: " />

			<TextBox Name="InputTextBox" />

		</toolkit:DockPanel>
	</Grid>

</labs:SilverlightLab>
